import userOption from "@/option/sys/userOption";
import userApi from "@/api/sys/userApi";
import optionUtils from "@/option/optionUtils";
import {baseUrl} from "@/config/env";

export default () => {
    return {
        index: true,
        submitText: '修改',
        size: 'small',
        labelWidth: 120,
        menuType: 'menu',
        menuAlign: 'center',
        menuPosition: "right",
        addBtn: false,
        delBtn: false,
        editBtn: false,
        column: [
            {
                label: '任务id',
                span: 12,
                prop: 'id',
                hide: true,
            },
            {
                label: '业务名称',
                prop: 'processDefinitionName',
                span: 12,
            },
            {
                label: '类别',
                prop: 'processDefinitionCategory',
                span: 12,
                type: "select",
                dicUrl: baseUrl + "/sysDictionaryItem/listByDictionaryCode",
                dicMethod: "get",
                dicQuery: {code: "activiti_group"},
                props: {
                    label: 'name',
                    value: 'code',
                },
            },
            {
                label: '申请人',
                span: 12,
                prop: 'processStartUserId',
                type: "table",
                onLoad: (onLoadParams, callback) => {
                    onLoadParams.pageDefinition = userApi.list
                    onLoadParams.valueDefinition = userApi.getUserInfo
                    onLoadParams.option = userOption;
                    optionUtils.tableOnLoad(onLoadParams, callback)
                },
                formatter: (row) => {
                    if (!row) return;
                    if (row.nickName) {
                        return row.nickName;
                    } else if (row.realName) {
                        return row.realName
                    }
                    return row.userName;
                }
            },
            {
                label: '业务状态',
                prop: 'processHandlerState',
                span: 12,
                type: "select",
                dicData: [
                    {label: "未提交流程", value: 0},
                    {label: "流程处理中", value: 1},
                    {label: "通过", value: 2},
                    {label: "驳回", value: 3},
                ]
            },
            {
                label: '申请时间',
                prop: 'createTime',
                span: 12,
                type: 'datetime',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                format: 'yyyy-MM-dd HH:mm:ss',
                editDisplay: false,
                addDisplay: false
            },

        ]
    }
}
